const express = require('express');

const router = express.Router();
// 判断权限
function checkAuthority(req, res, next) {
    // 统一登陆平台的用户权限信息
    let auth = res.locals.auth;
    console.log('checkAuthority-auth-----------', auth);
    if (auth && auth.content) {
        // let content = auth.content;
        next();
    } else {
        res.json('没有访问权限，请联系管理员配置权限');
        res.render('error');
    }
}

// 直接返回首页
router.use('/', checkAuthority, require('../controller/index'));

module.exports = router;
